/**
@author		Jong Min, Lee
@date		  01/22/2014
@breif		Monitor window class

copyright(c) Tae Young Soft. All right reserved. 2014
*/
#pragma once

#include "Taurus_Util/TUTypes.h"

#include "Taurus_Viewer/Defines.h"

class CMonitor;

/**
@brief Monitor window class
*/
class CMonitorWnd : public CFrameWnd
{
  DECLARE_DYNAMIC(CMonitorWnd)

public:

  typedef struct tagCreateParams
  {
    const CMonitor* theParentMonitor;

    unsigned int theMonitorIndex;

    tagCreateParams()
      : theParentMonitor(NULL)
      , theMonitorIndex(0)
    {
      theParentMonitor = NULL;
    }
  }CreateParams;

public:
  /**
  @brief		default constructor
  */
  CMonitorWnd();

  /**
  @brief		destructor
  @param		
  @return		
  */
  virtual ~CMonitorWnd();

  /**
  @brief		create monitor window
  @param		rcRect the position of the monitor window relative to top-left corner of the parent window
  @param    pParentWnd pointer to parent window
  @param    stCreateParams parameter to be used to create the monitor window
  @return	  TRUE if succeed, FALSE if not
  */
  BOOL create(const CRect& rcRect, CWnd* pParentWnd, CreateParams& stCreateParams);

  /**
  @brief		access parent monitor of monitor window
  @param		pointer to monitor
  */
  inline const CMonitor* getMonitor() const
  {
    return m_theMonitor;
  }

  /**
  @brief		access to monitor index
  @return		monitor index
  */
  inline unsigned int getMonitorIndex() const
  {
    return m_theMonitorIndex;
  }

private:
  /**
  @brief		initialize monitor window
  */
  void init();

  /**
  @brief		destroy all data members
  */
  void destroy();

  /**
  @brief		check createparams is legal
  @param		stCreateParams createparams
  @return		TRUE if legal, FALSE if not
  */
  BOOL validateCreateParams(const CreateParams* pParams) const;
  
private:
  //pointer to parent monitor
  const CMonitor* m_theMonitor;

  //monitor index
  unsigned int m_theMonitorIndex;

protected:
  DECLARE_MESSAGE_MAP()

public:
  virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  afx_msg void OnNcPaint();
  afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
  afx_msg void OnPaint();

};